import path from 'path'
import fs from 'fs'
export default function myExample(){
    return {
        name: 'myExample',
        writeBundle(a,bundles){
            let bundle = bundles['testmap.js'];
            let codes = '/*testmap 1.0 '+new Date().toLocaleString()+'*/'+'\n';
            let threeFilePath = path.resolve(__dirname , 'public/three.min.js')
            let threeCode = fs.readFileSync(threeFilePath)
            codes+=threeCode;
            codes+=bundle.code;
            let dest = path.resolve(__dirname,'dist/testmap-1.0.min.js');
            fs.writeFileSync(dest , codes , ()=>{
                console.log('bundles ok')
            })
        }
    }
}